package com.ajx.ablibrary.net;

import android.util.Log;

import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Random;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;

/**
 * Created by lai on 2017/9/12.
 */

public class Api extends ApiBase {
    private static final String TAG = "Api";

    public static Observable<ResponseBody> downloadWhiteName(int limit) {

        HashMap<String, String> map = new HashMap<>();
        Random random = new Random();
        int i = random.nextInt();
        Log.e(TAG, "downloadWhiteName 当前下载批次: " + limit+","+i);
        if (i % 2 == 1&&limit==3) {
            map.put("token", "7865013DD18BD826B4EEBFCE5236761F666");
        } else {
            map.put("token", "7865013DD18BD826B4EEBFCE5236761F");
        }
        map.put("mksn", "SJ6B598AFF8D5740C6");
        map.put("limit", limit + "");
        map.put("size", "50");
        String json = new Gson().toJson(map);
        RequestBody paraJson = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);

        return getService("http://120.31.135.83:8000", 0, 0).postJsonNoToken("/iacs/host/data/card", paraJson);
    }
}
